//
// Map: Island
// BSP: island
// Author: SteelRat

game_manager
{
	spawn
	{
		// Game rules
		wm_number_of_objectives 5
		wm_set_round_timelimit	15
		wm_set_main_objective 2 0 1
		wm_set_main_objective 2 1 2
		wm_objective_status 1 0 1  // Obj1, Axis in control of Docs.
		wm_objective_status 1 1 2	 // Obj1, Allies, not in control of Docs.
		wm_objective_status 2 0 1  // Obj2, Axis have prevented Allies from transmitting docs.
		wm_objective_status 2 1 2  // Obj2, Allies have not transmitted docs.
		wm_objective_status 3 0 1  // Obj3, Axis have prevented Allies from destroying Cannon Supply Doors.
		wm_objective_status 3 1 2  // Obj3, Allies have not destroyed the Cannon Supply Doors.
		wm_objective_status 4 0 2  // Obj4, Axis have not constructed Radio bunker doors.
		wm_objective_status 4 1 1  // Obj4, Allies dont have to destroy radio bunker doors
		wm_objective_status 5 0 1  // Obj5, Axis have defended the Cannon
		wm_objective_status 5 1 2  // Obj5, Allies have not destroyed the Cannon
		wm_set_defending_team	0	 // Axis is defending team
		accum 1 set 0			// Will be set to 1 if Allies have transmitted documents
		accum 2 set 0			// Will be set to 1 if Allies blow up the cannon
		// Stopwatch mode defending team (0=Axis, 1=Allies)
		wm_set_defending_team	0
		// Winner on expiration of round timer (0=Axis, 1=Allies)
		wm_setwinner	0
		setstate docsmarker default
		wait 200
		
	}		
	trigger checkgame
	{
	accum 1 abort_if_not_equal 1
	accum 2 abort_if_not_equal 1
	wm_setwinner 1
	wait 1500
	wm_endround
	}

	trigger objective1
	{
	wm_objective_status 2 1 1		// Allies have transmitted the docs
	wm_objective_status 2 0 2		// Axis have not prevented Allies from transmitting
	wm_set_main_objective 2 0 0
	wm_set_main_objective 2 1 1
	accum 1 set 1
	wm_announce "Allied team has transmitted the war documents!"
	trigger game_manager checkgame
	}	
	trigger axis_object_stolen
	{
	wm_objective_status 1 1 1		// Allies have stolen the docs
	wm_objective_status 1 0 2		// Axis have lost the docs
	setstate docsmarker invisible
	}
	trigger axis_object_returned
	{
	wm_objective_status 1 0 1		// Axis have returned the docs
	wm_objective_status 1 1 2		// Allies have lost the docs
	accum 1 set 0
	setstate docsmarker default
	}
	trigger objective2
	{
	wm_announce "Allies have destroyed the Cannon!"
	wm_objective_status 5 0 2
	wm_objective_status 5 1 1
	setstate gunsmoke default
	wait 200
	accum 2 set 1
	trigger game_manager checkgame	
	}
}
docsmarker
	spawn
	{	
	setstate docsmarker default
	}
	death
	{
	}
}
transmitter_obj
	{
	spawn
	{
	}
	death
	{
	trigger game_manager objective1
	}
}
cannon
{	
	spawn
	{
	setstate gunsmoke invisible
	wait 200
	set {
		health "100"
		constructible_class 1
		}
	}
	death
	{
	setstate gunsmoke default
	trigger game_manager objective2
	}
}
gundoor
{
	spawn
	{
	wait 200
	set {
		health "100"
		constructible_class 1
		}
	}
	death // this is called when the entity is destroyed... 
	{
	wm_announce "Allies have breached the Cannon Supply Doors!"
	wm_objective_status 3 0 2
	wm_objective_status 3 1 1
	}
}
radiodoor
{
	spawn
	{
		wait 200
		trigger radiodoor setup
	set {
		health "100"
		constructible_class 1
		}
	}

	trigger setup
	{
		setstate radio_door_materials default
		setstate radio_door_materials_clip default
		setstate radio_door_flag default
	}
	buildstart final
	{
		setstate radio_door_materials default
		setstate radio_door_materials_clip default
		setstate radio_door_flag default
	}
	built final
	{
		setstate radio_door_materials invisible
		setstate radio_door_materials_clip invisible
		setstate radio_door_flag invisible
		wm_objective_status 4 1 2
		wm_objective_status 4 0 1
		wm_announce "The Radio Bunker Door has been constructed!"
	}
	decayed final
	{
		setstate radio_door_materials default
		setstate radio_door_materials_clip default
		setstate radio_door_flag default
	}
	death
	{
		setstate radio_door_materials default
		setstate radio_door_materials_clip default
		setstate radio_door_flag default
		wm_objective_status 4 1 1
		wm_objective_status 4 0 2
		wm_announce "The Radio Bunker Door has been destroyed!"
	}
	trigger remove
	{
		setstate radio_door_toi invisible
		setstate radio_door_materials invisible
		setstate radio_door_materials_clip invisible
		setstate radio_door_flag invisible
		remove
	}
}
